package com.lxp.project.system.service.impl;

import com.lxp.common.utils.StringUtils;
import com.lxp.project.system.domain.SysNotice;
import com.lxp.project.system.mapper.SysNoticeMapper;
import com.lxp.project.system.service.ISysNoticeService;
import com.mybatisflex.core.query.QueryWrapper;
import com.mybatisflex.spring.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 公告 服务层实现
 *
 * @author lxp
 */
@Service
public class SysNoticeServiceImpl extends ServiceImpl<SysNoticeMapper, SysNotice> implements ISysNoticeService {

    /**
     * 查询公告列表
     *
     * @param notice 公告信息
     * @return 公告集合
     */
    @Override
    public List<SysNotice> selectNoticeList(SysNotice notice) {
        QueryWrapper lqw = new QueryWrapper();
        if (StringUtils.isNotBlank(notice.getNoticeTitle())) {
            lqw.like(SysNotice::getNoticeTitle, notice.getNoticeTitle());
        }
        if (StringUtils.isNotBlank(notice.getNoticeType())) {
            lqw.eq(SysNotice::getNoticeType, notice.getNoticeType());
        }
        if (StringUtils.isNotBlank(notice.getCreateBy())) {
            lqw.like(SysNotice::getCreateBy, notice.getCreateBy());
        }
        return this.list(lqw);
    }

}
